// BranchParam.cpp: implementation of the BranchParam class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "BranchParam.h"
#include "Branch.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
using namespace PDMS::PDMSDomain;

namespace PDMS
{
	namespace PDMSUI
	{
		BEGIN_REGISTER_MAP( BranchParam, NoteParamRegBase )
		REGISTER( UE_RUNTIME_CLASS( Branch ), GET_REGISTER( NoteParamRegBase, VersionOne ) )
		END_REGISTER_MAP();

		BranchParam::BranchParam()
		{
			
		}
		
		BranchParam::~BranchParam()
		{
			
		}

		UESoft::ErrorStatus BranchParam::Show( UeDbObject* pTree )
		{
			if ( pTree == NULL )
			{
				return UESoft::eNullObjectPointer;
			}
			if ( !pTree->IsKindOf( UE_RUNTIME_CLASS( Branch ) ) )
			{
				return UESoft::eUnKnownObjectPtrType;
			}
			
			Branch* pBranch = static_cast<Branch*>( pTree );
			CDlgBranchCreate dlg;
			dlg.SetShopFlag( pBranch->GetShopValue() );
			dlg.SetBuildFlag( pBranch->GetBuildValue() );
			dlg.SetTracingV( pBranch->GetTspecValue() );
			dlg.SetName( pBranch->Name() );
			dlg.SetSpecV( pBranch->GetPspecValue() );
			dlg.SetIspecV( pBranch->GetIspecValue() );
			dlg.SetTailDirV( pBranch->GetTdirValue() );
			dlg.SetHeadDirV( pBranch->GetHdirValue() );
			dlg.SetTailPosV( pBranch->GetTposValue() );
			dlg.SetHeadPosV( pBranch->GetHposValue() );
			dlg.SetTailRefV( pBranch->GetTrefValue() );
			dlg.SetHeadRefV( pBranch->GetHrefValue() );
			dlg.SetTailConnV( pBranch->GetTconnValue() );
			dlg.SetHeadConnV( pBranch->GetHconnValue() );
			dlg.SetTailBoreV( pBranch->GetTboreValue() );
			dlg.SetHeadBoreV( pBranch->GetHboreValue() );
			dlg.SetPurV( pBranch->GetPurpValue() );
			dlg.SetPtrefV( pBranch->GetPaintRef() );
			dlg.SetMatV( pBranch->GetMatrefValue() );
			dlg.SetFunV( pBranch->GetFucValue() );
			dlg.SetFluV( pBranch->GetFlurefValue() );
			dlg.SetDesV( pBranch->GetDscpValue() );
			dlg.SetCasV( pBranch->GetCasrefValue() );
			dlg.SetTempV( pBranch->GetTempValue() );
			dlg.SetPresV( pBranch->GetPresValue() );
			if ( IDOK == dlg.DoModal() )
			{
				pBranch->Name( dlg.GetName() );
				pBranch->SetBuildValue( dlg.GetBuildFlag() );
				pBranch->SetCasrefValue( dlg.GetCasV() );
				pBranch->SetDscpValue( dlg.GetDesV() );
				pBranch->SetFlurefValue( dlg.GetFluV() );
				pBranch->SetFucValue( dlg.GetFunV() );
				pBranch->SetHboreValue( dlg.GetHeadBoreV() );
				pBranch->SetHconnValue( dlg.GetHeadConnV() );
				pBranch->SetHdirValue( dlg.GetHeadDirV() );
				pBranch->SetHposValue( dlg.GetHeadPosV() );
				pBranch->SetHrefValue( dlg.GetHeadRefV() );
				//pBranch->SetHstubeValue()
				pBranch->SetIspecValue( dlg.GetIspecV() );
				pBranch->SetMatrefValue( dlg.GetMatV() );
				pBranch->SetPresValue( dlg.GetPresV() );
				pBranch->SetPspecValue( dlg.GetSpecV() );
				pBranch->SetPurpValue( dlg.GetPurV() );
				pBranch->SetShopValue( dlg.GetShopFlag() );
				pBranch->SetTboreValue( dlg.GetTailBoreV() );
				pBranch->SetTconnValue( dlg.GetTailConnV() );
				pBranch->SetTdirValue( dlg.GetTailDirV() );
				pBranch->SetTempValue( dlg.GetTempV() );
				pBranch->SetTposValue( dlg.GetTailPosV() );
				pBranch->SetTrefValue( dlg.GetTailRefV() );
				pBranch->SetTspecValue( dlg.GetTracingV() );
				pBranch->SetPaintRef( dlg.GetPtrefV() );
				
				return UESoft::eOk;
			}
			
			return UESoft::eCANCEL;
		}
	}
}

